<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>量子科技 - 新用户注册</title>
    <style>
        :root {
            --primary-color: #00a8ff;
            --dark-bg: #0f1621;
            --card-bg: #1a2233;
            --text-light: #e0e6f0;
            --accent-color: #00f7ff;
            --error-color: #ff4d4f;
        }

        body {
            background-color: var(--dark-bg);
            font-family: 'Segoe UI', Arial, sans-serif;
            color: var(--text-light);
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image:
                radial-gradient(circle at 20% 30%, rgba(0, 168, 255, 0.15) 0%, transparent 20%),
                radial-gradient(circle at 80% 70%, rgba(0, 247, 255, 0.15) 0%, transparent 20%);
        }

        .register-container {
            background-color: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            width: 420px;
            padding: 40px;
            position: relative;
            overflow: hidden;
        }

        .register-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
        }

        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo h1 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 5px;
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .logo p {
            font-size: 14px;
            opacity: 0.7;
            margin: 0;
        }

        .input-group {
            margin-bottom: 20px;
            position: relative;
        }

        .input-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 500;
        }

        .input-group input {
            width: 100%;
            padding: 12px 15px;
            background-color: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            color: var(--text-light);
            font-size: 14px;
            transition: all 0.3s;
        }

        .input-group input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
        }

        .password-strength {
            margin-top: 8px;
            height: 4px;
            background-color: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            overflow: hidden;
        }

        .strength-meter {
            height: 100%;
            width: 0;
            background: linear-gradient(90deg, #ff4d4f, #fadb14, #52c41a);
            transition: width 0.3s;
        }

        .terms-agreement {
            display: flex;
            align-items: flex-start;
            margin-bottom: 25px;
            font-size: 13px;
        }

        .terms-agreement input {
            margin-right: 8px;
            margin-top: 3px;
        }

        .terms-agreement a {
            color: var(--primary-color);
            text-decoration: none;
        }

        .register-btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
            border: none;
            border-radius: 6px;
            color: white;
            font-weight: 600;
            font-size: 15px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .register-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 168, 255, 0.4);
        }

        .login-link {
            text-align: center;
            margin-top: 25px;
            font-size: 14px;
        }

        .login-link a {
            color: var(--accent-color);
            text-decoration: none;
            font-weight: 500;
        }

        .error-message {
            color: var(--error-color);
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }

        .input-group.error input {
            border-color: var(--error-color);
        }

        .input-group.error .error-message {
            display: block;
        }

        .holographic-effect {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 300px;
            height: 300px;
            background: radial-gradient(circle, rgba(0, 168, 255, 0.1) 0%, transparent 70%);
            z-index: -1;
            opacity: 0.5;
        }
    </style>
</head>
<body>
    <div class="holographic-effect"></div>

    <div class="register-container">
        <div class="logo">
            <h1>QUANTECH</h1>
            <p>加入量子科技，开启未来之旅</p>
        </div>

        <form id="registerForm">
            <div class="input-group">
                <label for="username">用户名</label>
                <input type="text" id="username" placeholder="设置您的用户名">
                <div class="error-message">用户名必须为4-16位字母数字组合</div>
            </div>

            <div class="input-group">
                <label for="email">电子邮箱</label>
                <input type="email" id="email" placeholder="输入您的电子邮箱">
                <div class="error-message">请输入有效的电子邮箱地址</div>
            </div>

            <div class="input-group">
                <label for="password">密码</label>
                <input type="password" id="password" placeholder="设置您的密码">
                <div class="password-strength">
                    <div class="strength-meter" id="strengthMeter"></div>
                </div>
                <div class="error-message">密码必须包含大小写字母和数字，至少8位</div>
            </div>

            <div class="input-group">
                <label for="confirm-password">确认密码</label>
                <input type="password" id="confirm-password" placeholder="再次输入您的密码">
                <div class="error-message">两次输入的密码不一致</div>
            </div>

            <div class="terms-agreement">
                <input type="checkbox" id="terms">
                <label for="terms">我已阅读并同意 <a href="#">服务条款</a> 和 <a href="#">隐私政策</a></label>
            </div>

            <button type="submit" class="register-btn">注 册</button>
        </form>

        <div class="login-link">
            已有账户? <a href="http://127.0.0.1:5000/login">立即登录</a>
        </div>
    </div>

    <script>
        // 密码强度检测
        const passwordInput = document.getElementById('password');
        const strengthMeter = document.getElementById('strengthMeter');

        passwordInput.addEventListener('input', function() {
            const password = this.value;
            let strength = 0;

            if (password.length >= 8) strength += 25;
            if (/[A-Z]/.test(password)) strength += 25;
            if (/[a-z]/.test(password)) strength += 25;
            if (/[0-9]/.test(password)) strength += 25;

            strengthMeter.style.width = `${strength}%`;

            if (strength < 50) {
                strengthMeter.style.background = '#ff4d4f';
            } else if (strength < 75) {
                strengthMeter.style.background = '#fadb14';
            } else {
                strengthMeter.style.background = '#52c41a';
            }
        });

        // 表单验证
        const form = document.getElementById('registerForm');
        const inputs = form.querySelectorAll('input');

        inputs.forEach(input => {
            input.addEventListener('blur', function() {
                validateInput(this);
            });
        });

        function validateInput(input) {
            const group = input.closest('.input-group');
            const errorMessage = group.querySelector('.error-message');

            if (input.id === 'username') {
                const isValid = /^[a-zA-Z0-9]{4,16}$/.test(input.value);
                group.classList.toggle('error', !isValid);
            }
            else if (input.id === 'email') {
                const isValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input.value);
                group.classList.toggle('error', !isValid);
            }
            else if (input.id === 'password') {
                const isValid = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/.test(input.value);
                group.classList.toggle('error', !isValid);
            }
            else if (input.id === 'confirm-password') {
                const password = document.getElementById('password').value;
                const isValid = input.value === password;
                group.classList.toggle('error', !isValid);
            }
        }

        // 全息效果动画
        const holographic = document.querySelector('.holographic-effect');
        let angle = 0;

        function animateHolographic() {
            angle = (angle + 0.5) % 360;
            const x = 50 + Math.sin(angle * Math.PI / 180) * 10;
            const y = 50 + Math.cos(angle * Math.PI / 180) * 10;

            holographic.style.left = `${x}%`;
            holographic.style.top = `${y}%`;

            requestAnimationFrame(animateHolographic);
        }

        animateHolographic();
    </script>
</body>
</html>